package com.rs.game.player.dialogues.impl;

import com.rs.game.WorldTile;
import com.rs.game.player.content.dungeoneering.DungeonConstants;
import com.rs.game.player.dialogues.Dialogue;


public class DungeonExit extends Dialogue {

	int npcId;

	@Override
	public void start() {
		sendDialogue("This ladder leads back to the surface. You will not be able",
				"to come back to this dungeon if you leave.");

	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			sendOptionsDialogue("Leave the dungeon and return to the surface?", "Yes.", "No.");
			stage = 0;
		} else if (stage == 0) {
			if (componentId == OPTION_1) {
				player.setNextWorldTile(new WorldTile(3456, 3722, 1));
				player.getControlerManager().getControler().removeControler();
				player.getControlerManager().forceStop();
				player.getPackets().closeInterface(player.getInterfaceManager().hasRezizableScreen() ? 34 : 8);
				player.useStairs(-1, new WorldTile(DungeonConstants.OUTSIDE, 2), 0, 1);
				player.getCombatDefinitions().removeDungeonneringBook();
				player.setForceMultiArea(false);
				player.getControlerManager().removeControlerWithoutCheck();
				player.getInterfaceManager().removeOverlay(false);
				end();
			} else if (componentId == OPTION_2) {
				end();
			}
		}
	}

	@Override
	public void finish() {

	}

}
